@extends('layouts.default') @section('main')
<link rel="stylesheet" href="/css/uniform.css" />
<link rel="stylesheet" href="/css/select2.css" />
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a href="{{url('home')}}" title="返回首页" class="tip-bottom"><i
				class="icon-home"></i> 首页</a> <a href="#" class="current">活动视频管理</a>
		</div>
	</div>
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				@if(in_array('add',$actions)) <a href="{{url('activityprojectvideo/create')}}"><button
						class="btn">新增</button></a> @endif
                    <form action="{{url('activityprojectvideo/search')}}" method="post">
                        <table>
                            <tr>

                                <th>
                                    <label >视频名称 :</label>
                                </th>
                                <th>
                                    <div class="controls">
                                        <input type="text" class="span11" name="video_name" value="" placeholder="视频名称" />
                                    </div>
                                </th>
                                <th>
                                    <label >活动名称 :</label>
                                </th>
                                <th>
                                    <div class="controls">
                                        <input type="text" class="span11" name="activity_name" value="" placeholder="活动名称" />
                                    </div>
                                </th>

                                <th>
                                    <label >项目名称 :</label>
                                </th>
                                <th>
                                    <div class="controls">
                                        <input type="text" class="span11" name="project_name" value="" placeholder="项目名称" />
                                    </div>
                                </th>

                                <th>
                                    <label >是否精彩 :</label>
                                </th>
                                <th>
                                    <div class="controls">
                                        <select  name="wonderful" class="span11" >
                                            <option value="">请选择</option>
                                                <option value="0">不精彩</option>
                                                <option value="1">精彩</option>

                                        </select>
                                    </div>
                                </th>

                                <th>
                                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                    <div class="controls">
                                        <button type="submit" class="btn btn-info">查询</button>
                                    </div>
                                </th>
                            </tr>
                        </table>
                    </form>
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon"><i class="icon-th"></i></span>
						<h5>活动视频管理</h5>
					</div>
					<div class="widget-content nopadding">
						<table class="table table-bordered table-striped">
							<thead>
								<tr>
                                    <th>视频名称</th>
                                    <th>活动名称</th>
									<th>项目名称</th>
									<th>创建时间</th>
									<th>视频详情</th>
									<th>视频评论(数量)</th>
									<th>播放量</th>
									<th>收藏量</th>
									<th>是否精彩</th>
									<th>是否热门</th>
									<th>是否置顶</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								@foreach($r_datas as $key => $data)
                                    <tr class="gradeX">
                                        <td title="{{$data->subject}}">{{cut_str($data->subject,10)}}</td>
                                        <td @if(isset($data->activity)) title="{{$data->activity->subject}}" @endif>@if(isset($data->activity)){{cut_str($data->activity->subject,10)}}@endif</td>
                                        <td @if(isset($data->project)) title="{{$data->project->subject}}" @endif>@if(isset($data->project)){{cut_str($data->project->subject,10)}}@endif</td>
                                        <td>{{date('Y-m-d', strtotime($data->created_at->toDateTimeString()))}}</td>
                                        <td><a href="{{action('ActivityProjectVideoController@getDetail',['vid'=>$data->id])}}">点击查看</a></td>
                                        <td><a href="{{url('activityvideocomment/comment-list?id='.$data->id)}}">点击查看（{{$data->c_count}}）</a></td>
                                        <td>{{$data->views}}</td>
                                        <td>{{$data->f_count}}</td>
                                        <td>@if($data->wonderful == 1)<i class="icon-ok"></i>@elseif($data->wonderful == 0)<i class="icon-remove"></i>@endif</td>
                                        <td>@if($data->hot == 1)<i class="icon-ok"></i>@elseif($data->hot == 0)<i class="icon-remove"></i>@endif</td>
                                        <td>@if($data->top == 1)<i class="icon-ok"></i>@elseif($data->top == 0)<i class="icon-remove"></i>@endif</td>
                                        <td class="center">@if(in_array('edit',$actions)) <a
                                                    data-original-title="编辑" class="tip"
                                                    href="{{action('ActivityProjectVideoController@getEdit',['vid'=>$data->id])}}"><i
                                                        class="icon-pencil"></i></a> @endif
                                            @if(in_array('delete',$actions)) <a data-original-title="删除"
                                                                                data-toggle="modal" class="tip activity_project_video_delete"
                                                                                activity_project_video_id="{{$data->id}}" href="#myAlert"><i
                                                        class="icon-remove"></i></a> @endif
                                        </td>
                                    </tr>
								@endforeach
							</tbody>
						</table>
					</div>
				</div>
                    <?php echo $datas->render();?>
      </div>
		</div>
	</div>
</div>
<div>
	<div id="myAlert" class="modal hide">
		<div class="modal-header">
			<button data-dismiss="modal" class="close" type="button">×</button>
			<h3>提示</h3>
		</div>
		<div class="modal-body">
			<p>确认删除这条数据吗？</p>
		</div>
		<div class="modal-footer">
			<a data-dismiss="modal" class="btn btn-primary" href="javascript:void(0);">确定</a>
			<a data-dismiss="modal" class="btn" href="javascript:void(0);">取消</a>
		</div>
	</div>
	<form action="{{url('activityprojectvideo/delete')}}" method="post"
		id="activityprojectvideoForm">
		<input type="hidden" name="vid" value="0">
	</form>
</div>
<script src="/js/matrix.tables.js"></script>
<script src="/js/common.js"></script>
<script>
$(".activity_project_video_delete").click(function(){
	var activity_project_video_id = $(this).attr("activity_project_video_id");
	$("input[name='vid']").val(activity_project_video_id);
});
$(".btn-primary").click(function(){
	var activity_project_video_id = $("input[name='vid']").val();
	if(activity_project_video_id == 0){
		alert('参数异常');
		return;
	}
	ajaxRequest($('#activityprojectvideoForm').serializeArray(),$('#activityprojectvideoForm').attr('action'),function(data){
		if(data.status){
			window.location.href = data.forwardUrl;
		}else{
			alert(data.message);
		}
	});
});
</script>
@stop
